<tr data-parent-id="<%= shop_category.parent.blank? ? 0 : shop_category.parent_id %>" data-id="<%= shop_category.id %>">
  <td style="padding-left:<%= index * 30 %>px;">
    <div onclick="toggleShopCategoryTree(<%= shop_category.id %>);"><%= shop_category.name %>（id:<%= shop_category.id %> | level: <%= shop_category.level %>）</div>
    <div class="small text-muted">
      <%= formattime(shop_category.created_at, unit: "day") %>
    </div>
  </td>
  <td class="text-center">
    <div class="avatar d-block" style="background-image: url(<%= shop_category.avatar.url %>)">
      <span class="avatar-status bg-green"></span>
    </div>
  </td>
  <td>
    <div><%= shop_category.sort %></div>
  </td>
  <td>
    <div><%= shop_category.published ? "显示" : "隐藏" %></div>
  </td>
  <td>
    <% if shop_category.level == 1 %>
    <div><%= link_to "品牌", admin_shop_category_shop_category_brands_path(shop_category) %></div>
    <% end %>
  </td>
  <td>
    <% if shop_category.level == 2 %>
    <div><%= link_to "属性", admin_shop_category_option_types_path(shop_category) %></div>
    <% end %>
  </td>
  <td class="text-center">
    <div class="item-action dropdown">
      <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
      <div class="dropdown-menu dropdown-menu-right">
        <a href="<%= edit_admin_shop_category_path(shop_category) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
        <%= link_to admin_shop_category_path(shop_category), method: :delete, class: 'dropdown-item' do %>
          <i class="dropdown-icon fe fe-edit-2"></i> 删除 
        <% end %>
        <% if not shop_category.level == 3 %>
        <a href="<%= new_admin_shop_category_path(parent_id: shop_category.id) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 添加子分类 </a>
        <% end %>
      </div>
    </div>
  </td>
</tr>
